package com.example.a10928.weifriend.ui.personal_center

import android.graphics.Color
import android.support.v7.app.AppCompatActivity
import android.os.Bundle
import android.support.design.widget.TabLayout
import android.support.v4.app.Fragment
import android.support.v4.content.ContextCompat
import android.support.v4.view.ViewPager
import android.view.View
import com.example.a10928.weifriend.R
import com.example.a10928.weifriend.adapter.MyViewPageAdapter
import com.example.a10928.weifriend.http.api.VariableName
import com.example.a10928.weifriend.ui.BaseActivity
import com.example.a10928.weifriend.ui.rank_list.RankFragment
import com.example.a10928.weifriend.util.StatusBarUtil
import com.githang.statusbar.StatusBarCompat
import kotlinx.android.synthetic.main.activity_my_adert.*
import java.util.ArrayList

class MyAdertActivity : BaseActivity() {
    override fun getContentView(): Int {
        return R.layout.activity_my_adert
    }

    override fun initView() {

        StatusBarCompat.setStatusBarColor(this, Color.WHITE,true)
        supportActionBar?.hide()


    }

    override fun initData() {
        val titleData = ArrayList<String>()
        titleData.add("进行中")
        titleData.add("待审核")
        titleData.add("待发布")
        titleData.add("已完成")

        val fragments = ArrayList<Fragment>()



        fragments.add(getFragment("1"))
        fragments.add(getFragment("2"))
        fragments.add(getFragment("3"))
        fragments.add(getFragment("4"))

        val adapter = MyViewPageAdapter(getSupportFragmentManager(), titleData, fragments)

        vp.adapter = adapter
        tablayout.setupWithViewPager(vp)
        tablayout.setTabsFromPagerAdapter(adapter)




    }

    fun getFragment(type:String):AdertFragment{

        var fragment=AdertFragment()
        var bundle=Bundle()
        bundle.putString(VariableName.TYPE,type)
        fragment.arguments=bundle

        return fragment

    }


}
